package com.craterhill.java.ccp.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.craterhill.java.ccp.common.beans.Staff;
import com.craterhill.java.ccp.dao.impl.AbstractDao;
import com.craterhill.java.ccp.dao.utils.CCPResultSetExtractor;

public interface StaffDao extends CCPDao<Staff> {
	public final String FIELD_LIST = "obj.staff_id, obj.staff_number, obj.first_name, obj.middle_name, obj.last_name, obj.user_name,"
			+ "obj.password, obj.can_change_password, obj.position_id, obj.date_of_birth, obj.gender, obj.street, obj.area, obj.city, obj.state,"
			+ "obj.country_id, obj.zip_code, obj.mobile_number, obj.home_number, obj.other_phone_number, obj.email, obj.profile_image_path, obj.spouse_name,"
			+ "obj.more_info, obj.qualification, obj.university, obj.experience, obj.subject_matter_expert, obj.additional_curricular_activities, obj.rewards_achievements,"
			+ "obj.memberships, obj.address_others, obj.date_of_hire, obj.date_of_termination, obj.date_of_retirement"
			+ AbstractDao.MONITER_FIELDS;

	public final String FIND_ALL_STAFF = " select " + FIELD_LIST + " from staff obj ";

	public final class StaffExtractor extends CCPResultSetExtractor<Staff> {

		@Override
		protected Staff extractResultSetData(ResultSet resultSet) throws SQLException {
			Staff staff = new Staff();
			staff.setStaffId(resultSet.getInt(1));
			staff.setStaffNumber(resultSet.getString(2));
			staff.setFirstName(resultSet.getString(3));
			staff.setMiddleName(resultSet.getString(4));
			staff.setLastName(resultSet.getString(5));
			staff.setUserName(resultSet.getString(6));
			staff.setPassword(resultSet.getString(7));
			staff.setCanChangePassword(resultSet.getBoolean(8));
			staff.setPositionId(resultSet.getInt(9));
			staff.setDateOfBirth(resultSet.getDate(10));
			staff.setGender(resultSet.getInt(11));
			staff.setStreet(resultSet.getString(12));
			staff.setArea(resultSet.getString(13));
			staff.setCity(resultSet.getString(14));
			staff.setState(resultSet.getString(15));
			staff.setCountryId(resultSet.getInt(16));
			staff.setZipCode(resultSet.getInt(17));
			staff.setMobileNumber(resultSet.getString(18));
			staff.setHomeNumber(resultSet.getString(19));
			staff.setOtherPhoneNumber(resultSet.getString(20));
			staff.setEmail(resultSet.getString(21));
			staff.setProfileImagePath(resultSet.getString(22));
			staff.setSpouseName(resultSet.getString(23));
			staff.setMoreInfo(resultSet.getString(24));
			staff.setQualification(resultSet.getString(25));
			staff.setUniversity(resultSet.getString(26));
			staff.setExperience(resultSet.getString(27));
			staff.setSubjectMatterExpert(resultSet.getString(28));
			staff.setAdditionalCurricularActivities(resultSet.getString(29));
			staff.setRewardsAchievements(resultSet.getString(30));
			staff.setMemberships(resultSet.getString(31));
			staff.setAddressOthers(resultSet.getString(32));
			staff.setDateOfHire(resultSet.getDate(33));
			staff.setDateOfTermination(resultSet.getDate(34));
			staff.setDateOfRetirement(resultSet.getDate(35));
			staff.setStatus(resultSet.getBoolean(36));
			staff.setCreatedBy(resultSet.getInt(37));
			staff.setModifiedBy(resultSet.getInt(38));
			staff.setCreatedDate(resultSet.getDate(39));
			staff.setModifiedDate(resultSet.getDate(40));
			return staff;

		}

	}

}
